let path = require("path");
let HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
    devServer: {//开发服务器的配置
        port: 8080,//端口
        progress: true,//进度
        contentBase: "./dist",//根目录
        open: true,//自动打开默认浏览器
        compress: true//传输gzip
    },
    mode: "development",
    entry: {
        home: './src/index.js',
        other: './src/other.js'
    },
    output: {
        filename: "[name].js",
        path: path.resolve(__dirname, 'dist')//路径必须一个绝对路径
    },
    plugins: [
        new HtmlWebpackPlugin({
            title: "home",
            template: "./src/index.html",
            filename: "home.html",
            chunks: ['home']
        }),
        new HtmlWebpackPlugin({
            title: "other",
            template: "./src/index.html",
            filename: "other.html",
            chunks: ["other","home"]
        })
    ]
}